package com.lyf.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @AUTHOR LYF
 * @DATE 2022/2/6
 * @VERSION 1.0
 * @DESC
 */
@Configuration
public class GatewayRouterConfig {
    @Bean
    RouteLocator biliRouter(RouteLocatorBuilder routeLocatorBuilder){
        //https://www.bilibili.com/

        RouteLocatorBuilder.Builder builder  = routeLocatorBuilder.routes();
        builder.route("bili_router",predicateSpec ->
                predicateSpec.path("/").uri("https://www.bilibili.com"));// path

        return builder.build();
    }
}
